import React,{ Component } from 'react';
import { connect } from 'react-redux';
import User from '../components/user';//主页
import Login from '../components/user_them/login';//登录页
import {user_logined} from '../actions';

class userView extends Component{
  constructor(props) {
    super(props)
  }
  render(){
    return this.props.user_logined?(
      <div id="user_view">
        <User />
      </div>
    ):(
      <div id="user_view">
        <Login />
      </div>
    )
  }
}

const mapStateToProps = (state) => {
  let user_logined = !!state.user.user_logined || false;
  return {
    user_logined:user_logined
  }
}

export default connect(mapStateToProps)(userView)
